import './assets/main.css'

import {createApp} from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import './assets/main.css';
import router from './router'
import {http} from "@/components/network.js";
import axios from 'axios';
import store from './store'; // 引入 Vuex Store
import 'github-markdown-css/github-markdown.css'

const app = createApp(App)
const axiosInstance = axios.create({
    baseURL: 'http://39.105.217.183:8000', // Django 后端的 API 根路径
});
const savedUser = JSON.parse(localStorage.getItem("user"));
if (savedUser) {
    store.dispatch("setUser", savedUser).then(() => {
        console.log("用户信息已恢复");
    }).catch((error) => {
        console.error("恢复用户信息失败", error);
    });
}
export default axiosInstance;

app.config.globalProperties.$http = http
app.use(ElementPlus)
app.use(router)
app.use(store);
app.use(ElementPlus);
app.mount('#app')
